<?php
include("conn.php");

$res['name'] = [];
$res['time'] = [];
$res['score'] = [];
$res['status'] = [];

$conn->query('set names utf8');
$sql = "SELECT * FROM pen_score";
$result = $conn->query($sql);

if($result->num_rows > 0){
    while($row = $result->fetch_assoc()){
        $res['name'][] = $row['name'];
        $res['time'][] = $row['time'];
        $res['score'][] = $row['score'];
        $res['status'][] = $row['score'] >= 60 ? '及格' : '不及格';
    }
}

$res = json_encode($res);
print($res);